import React from "react";
import MainLayout from "@/component/mainLayout/mainLayout";
import { connect } from "react-redux";
import Button from "../components/button";

// import yhTools from "@/tools/yh";
import LivenessTop from "./components/top";
import creditStore from "../creditStore";
import xhdTool from "./xhdTool";
import "./index.scss";

const Liveness = props => {
	const openProtocol = () => {
		props.history.push("/faceAgreement");
	};
	const _pageParams = {
		header: {
			title: "人脸识别"
		},
		isModal: true,
		history: props.history,
		cacheLifecycles: props.cacheLifecycles
	};
	const submit = () => {
		console.log("033333");
		xhdTool.startLive(props);
	};
	return (
		<MainLayout pageParams={_pageParams} handleBack={props.handleBack}>
			<div className="xhd-liveness">
				<div className="xhd-liveness-wrapper">
					<LivenessTop />
					<p className="xhd-liveness-wrapper-protocol" onClick={openProtocol}>
						查看<a>《人像识别协议》</a>
					</p>
				</div>
				<Button isHiddenBotton={true} onClick={submit}>
					同意协议并验证
				</Button>
			</div>
		</MainLayout>
	);
};

export default connect(state => state)(creditStore(Liveness));
